<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学IT - 后台管理系统</title>
    <?php include( './views/common/style.html' ) ?>
</head>
<body>
    
    <!-- 侧边栏 -->
    <?php include( './views/common/aside.html' ) ?>
    <!-- 主体 -->
    <div class="main">
        <div class="container-fluid">
            <!-- 头部 -->
            <?php include( './views/common/header.html' ) ?>
            <div class="body teacher" id="addTeacher">
                <!-- 面包屑 -->
                <!-- 模板-->
            </div>
        </div>
    </div>
    <script type="text/template" id="teacherTpl">
        <ol class="breadcrumb">
            <li><a href="javascript:;">讲师管理</a></li>
            <li class="active" id="crumb">{{tc_nav}}</li>
        </ol>
        <div class="teacher-add">
            <form id="addForm" class="form-horizontal col-md-offset-2">
                <!-- 因为后面要用id,我们想用表单自动获取的方式获得,所以可以设置一个隐形的表单控件-->
                {{if tc_id}}
                    <input type="hidden" name="tc_id" value="{{tc_id}}" />
                {{/if}}
                <div class="form-group">
                    <label for="" class="col-md-3 control-label">姓名</label>
                    <div class="col-md-4">
                        <input type="text" class="form-control input-sm"
                               placeholder="讲师名称"
                               name="tc_name"
                               value="{{tc_name}}"
                               data-required
                               data-describedby="for_tc_name"
                               data-description="tcname">
                        <span id="for_tc_name"></span>
                    </div>
                </div>
                {{if tc_name == null}}<!-- 说明是添加页面,编辑页面不需要密码-->
                    <div class="form-group">
                        <label for="" class="col-md-3 control-label">密码</label>
                        <div class="col-md-4">
                            <input type="password"
                                   class="form-control input-sm"
                                   name="tc_pass"
                                   data-required
                                   data-pattern="^\d+$"
                                   data-describedby="for_tc_pass"
                                   data-description="tcpass"
                                    >
                            <span id="for_tc_pass"></span>
                        </div>
                    </div>
                {{/if}}
                <div class="form-group">
                    <label for="" class="col-md-3 control-label">入职时间</label>
                    <div class="col-md-4">
                        <!-- 用了bootstrap-datepicker日期插件-->
                        <input type="text"
                               class="form-control input-sm"
                               name="tc_join_date"
                               value="{{tc_join_date}}"
                               data-provide="datepicker"
                               data-date-format="yyyy-mm-dd"
                               data-date-autoclose="true"
                               data-required
                               data-describedby="for_join_date"
                               data-description="joindate"
                                >
                        <span id="for_join_date"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-3 control-label">类型</label>
                    <div class="col-md-2">
                        <select name="tc_type" class="form-control input-sm">
                            <option value="1"
                                    {{ if tc_type === 1 }} selected {{ /if }}>讲师</option>
                            <option value="0"
                                    {{ if tc_type === 0 }} selected {{ /if }} >管理员</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-md-3 control-label">性别</label>
                    <div class="col-md-4">
                        <label class="radio-inline">
                            <input type="radio"
                                   value="0"
                                   name="tc_gender"
                                   {{ if tc_gender-0 === 0 || tc_gender === undefined }}checked{{ /if }}> 男
                            <!-- undefined代表默认是男-->
                        </label>
                        <label class="radio-inline">
                            <input type="radio"
                                   value="1"
                                   name="tc_gender"
                                   {{ if tc_gender-0 === 1 }}checked{{ /if }}> 女
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-7">
                        <input type="submit" class="btn btn-success btn-sm pull-right" value="{{tc_btn_value}}">
                    </div>
                </div>
            </form>
        </div>

    </script>
    <?php include( './views/common/script.html' ) ?>
    <script>
         require(["teacherAdd"]);
    </script>
</body>
</html>